﻿using System;
using System.Collections.Generic;
using System.Text;

using MapCenterSystem.DataInfo;
using System.Data.SqlClient;
using MapCenterSystem.Configuration;
using System.Data;
using MapCenterSystem.DefineType;

namespace MapCenterSystem.DataAccess
{
    public class StreetServicesEx : StreetServices
    {
        public static string GetFullNameById(int id)
        {
            using (SqlConnection sqlConnect = new SqlConnection(GlobalConfig.ConnectionString))
            {
                SqlCommand command = new SqlCommand();
                command.CommandText = "sp_Street_GetStreetById";
                command.CommandType = CommandType.StoredProcedure;
                command.Connection = sqlConnect;
                command.Parameters.AddWithValue("@id", id);
                try
                {
                    sqlConnect.Open();
                }
                catch
                {
                    throw new Exception("Can not connect to database. Please check connect");
                }

                return (string)command.ExecuteScalar();
            }
        }
    }
}
